package main

import "fmt"

/*
切片或者数组去重
Input: [2,2,1]
Output: 1
Example 2:
Input: [4,1,2,1,2]
Output: 4
*/
func main() {
	slice := []int{5, 3, 2, 4, 5, 2, 1}
	m := make(map[int]int)
	for _, v := range slice {
		_, ok := m[v]
		if ok {
			delete(m, v)
		} else {
			m[v] = v
		}
	}
	for _, v := range m {
		fmt.Println(v)
	}

}
